package net.openl10n.adapters;

import java.util.HashMap;
import java.util.Map;

import net.openl10n.adapters.DocumentStreamReader.Event;
import net.openl10n.extensions.ExtensionId;
import net.openl10n.extensions.IExtension;
import net.openl10n.mdf.DocumentId;
import net.openl10n.mdf.PartId;

import com.google.common.collect.ImmutableSet;

public class CachedEvent {
	public DocumentId documentId;
	public Long documentVersion;
	public PartId documentPartId;
	public Event event;
	public String content;
	public Map<ExtensionId, IExtension> extensions = new HashMap<ExtensionId, IExtension>();
	private ImmutableSet<ExtensionId> extensionsSet;
	
	public ImmutableSet<ExtensionId> getExtensions(){
		if(extensionsSet == null)
			extensionsSet = ImmutableSet.copyOf(extensions.keySet());
		return extensionsSet;
	}
	
	public void reset(){
		documentId = null;
		documentVersion = null;
		documentPartId = null;
		content = null;
		extensionsSet = null;
		extensions.clear();
	}
}
